<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增成交客户信息')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-table-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">地区：</label>
            <div class="col-sm-8">
                <select id="area" name="area" class="form-control"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">剩余名额：</label>
            <div class="col-sm-8">
                <input name="remaining" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">成交名额：</label>
            <div class="col-sm-8">
                <input name="dealDone" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/table"
    var prefixs = ctx + "system/name"
    $("#form-table-add").validate({
        focusCleanup: true
    });
    selectCityName();

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-table-add').serialize());
        }
    }

    function selectCityName() {
        $.ajax({
            url: prefixs + "/selectCityName",
            type: "get",
            dataType: "json",
            data: {},
            success: function (data) {
                if (data.length > 0) {
                    for (i in data) {
                        $("#area").append("<option>" + data[i].cityName + "</option>")
                    }
                } else {
                    $("#area").append("<option>暂无数据</option>")
                }
            },
        })
    }
</script>
</body>
</html>